﻿using Microsoft.Practices.Prism.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HDFSViewer.Component;

namespace HDFSViewer.ViewModel
{
    public class AddDirectoryWindowVM : NotifyObject
    {
        private string _path = null;
        public string Path
        {
            get { return _path; }
            set
            {
                _path = value;
                this.RaisePropertyChanged("Path");
            }
        }

        private string _directoryName = null;
        public string DirectoryName
        {
            get { return _directoryName; }
            set
            {
                _directoryName = value;
                OK.RaiseCanExecuteChanged();
                this.RaisePropertyChanged("DirectoryName");
            }
        }

        public DelegateCommand OK { get; set; }

        public AddDirectoryWindowVM(string path)
        {
            this.Path = path;
            OK = new DelegateCommand(DoOK, DoCanOK);
        }

        private void DoOK() { }

        private bool DoCanOK()
        {
            if (!string.IsNullOrWhiteSpace(DirectoryName))
            {
                return true;
            }
            else return false;
        }
    }
}
